<!DOCTYPE html>
<html lang="en">
<head>
  <{include file="public_html/header_tag.html"}>
    <title>评价</title>
</head>
<body>
    <div class="fix p20 b-FFFFFF oh" id="layui_flow">
        <{foreach from=$list item=item}>        
        <dl class="layout-box brB ptb20">
            <dt class="mr20">
                <div class="ith_img" style="width:2rem; height:2rem; background-image:url(<{$item.head_image_url}>)"></div>
            </dt>
            <dd class="box-col">
                <div class=""><{$item.nick}></div>
                <div><span class="c-666666"><{$item['add_time']|date_format:'%Y-%m-%d'}></span></div>
                <div><{$item.content}></div>
            </dd>
        </dl>
        <{/foreach}>
        <{if count($list) == 0}>
        <dl class="fix line-bottom p-b20 m-b20">
            赞无评论
        </dl>
        <{/if}>
    </div>
<link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
<script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="/static/public/layer/src/layui.js"></script>
<script>
layui.use('flow', function(){
    var flow = layui.flow;
    flow.load({
        elem: '#layui_flow' //流加载容器
        ,isAuto:false
        ,scrollElem: '#layui_flow' //滚动条所在元素，一般不用填，此处只是演示需要。
        ,done: function(page, next){ //执行下一页的回调
            //模拟数据插入
            setTimeout(function(){
                var lis = [];
                if(page > 1){
                    $.ajax({
                        type: "GET",
                        url: "/video/video_comment_list/<{$course_id}>/"+page+"/1",
                        dataType:"json",
                        success: function(result){
                            if(result){
                                $.each(result,function(i,j){
                                    html = '';
                                    html += '<dl class="layout-box brB ptb20">';
                                    html += '<dt class="mr20">';
                                    html += '<div class="ith_img" style="width:2rem; height:2rem; background-image:url('+j.head_image_url+')"></div>';
                                    html += '</dt>';
                                    html += '<dd class="box-col">';
                                    html += '<div class="">'+j.nick+'</div>';
                                    html += '<div><span class="c-666666">'+j.add_time+'</span></div>';
                                    html += '<div><{$item.content}></div>';
                                    html += '</dd>';
                                    html += '</dl>';
                                    // lis.push('<li>'+ ( (page-1)*8 + i + 1 ) +'</li>')
                                    lis.push(html)
                                    $("#layui_flow").find("dl:last").after(html)
                                    // console.log(html)
                                    var parent_elment = $(window.parent.document).find("#list");
                                    var height = parent_elment.height() + 62;
                                    $(window.parent.document).find("#list").attr("style", "height:"+height+"px;")
                                });

                            }
                        }
                    });
                }
                
            //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
            //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                next(lis.join(''), page < "<{$count-1}>"); //假设总页数为 10
            }, 500);
        }
    });
});
</script>
</body>
</html>
